package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//敏感词操作
@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {
    @Autowired
    WmSensitiveService wmSensitiveService;
    //保存
    @PostMapping("/save")
    public ResponseResult addSensitive(@RequestBody WmSensitive wmSensitive) {
        return  wmSensitiveService.addSensitive(wmSensitive);
    }
    //删除
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable Integer id) {
        return  wmSensitiveService.deleteSensitive(id);
    }
    //查询列表
    @PostMapping("/list")
    public PageResponseResult findAll(@RequestBody SensitiveDto dto) {
        return  wmSensitiveService.findAll(dto);
    }

    //修改
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return  wmSensitiveService.updateSensitive(wmSensitive);
    }
}
